home *** CD-ROM | disk | FTP | other *** search
- /***
- *varargs.h - XENIX style macros for variable argument functions
- *
- * Copyright (c) 1985-1990, Microsoft Corporation. All rights reserved.
- *
- *Purpose:
- * This file defines XENIX style macros for accessing arguments of a
- * function which takes a variable number of arguments.
- * [System V]
- *
- ****/
-
- #ifndef _INC_VARARGS
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #ifdef __STDC__
- #error varargs.h incompatible with ANSI (use stdarg.h)
- #endif
-
- #ifndef _VA_LIST_DEFINED
- typedef char *va_list;
- #define _VA_LIST_DEFINED
- #endif
-
-
-
- #ifdef _X86_
- /*
- * define a macro to compute the size of a type, variable or expression,
- * rounded up to the nearest multiple of sizeof(int). This number is its
- * size as function argument (Intel architecture). Note that the macro
- * depends on sizeof(int) being a power of 2!
- */
-
- #define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
-
- #define va_dcl va_list va_alist;
- #define va_start(ap) ap = (va_list)&va_alist
- #define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
- #define va_end(ap) ap = (va_list)0
- #endif
-
- #ifdef M_MRX000
-
- #define va_dcl int va_alist;
- #define va_start(ap) ap = (va_list)&va_alist
- #define va_arg(ap,t) *((t*)(_va_arg(&(ap),sizeof(t),(t*)0,(t*)0)))
- #define va_end(ap)
-
- #else
- #ifdef _MIPS_
- #define va_dcl int va_alist;
- #define va_start(list) list = (char *) &va_alist
- #define va_end(list)
- #define va_arg(list, mode) ((mode *)(list =\
- (char *) ((((int)list + (__builtin_alignof(mode)<=4?3:7)) &\
- (__builtin_alignof(mode)<=4?-4:-8))+sizeof(mode))))[-1]
- /* +++++++++++++++++++++++++++++++++++++++++++
- Because of parameter passing conventions in C:
- use mode=int for char, and short types
- use mode=double for float types
- use a pointer for array types
- +++++++++++++++++++++++++++++++++++++++++++ */
- #endif
- #endif
-
-
- #ifdef __cplusplus
- }
- #endif
-
- #define _INC_VARARGS
- #endif /* _INC_VARARGS */
-